package data_structure.binary_tree;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class BinaryTreeTest {

    /**
     * 先序遍历   左 中 右
     */
    @Test
    public void preorder() {
        BinaryTree bintree = new BinaryTree();
        Object[] a = {2, 4, 5, 7, 1, 6, 12, 32, 51, 22};
        bintree.creat(a);
        bintree.preorder(bintree.root);
    }

    /**
     * 中序遍历
     */
    @Test
    public void inorder() {
        BinaryTree bintree = new BinaryTree();
        Object[] a = {2, 4, 5, 7, 1, 6, 12, 32, 51, 22};
        bintree.creat(a);
        bintree.inorder(bintree.root);
    }

    /**
     * 后序遍历
     */
    @Test
    public void afterorder() {
        BinaryTree bintree = new BinaryTree();
        Object[] a = {2, 4, 5, 7, 1, 6, 12, 32, 51, 22};
        bintree.creat(a);
        bintree.afterorder(bintree.root);
    }


}
